home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news1.io.org!torfree!bz786
- From: bz786@torfree.net (Sherif Asif)
- Subject: Help to detect error
- Message-ID: <DpMA82.KEE.0.bloor@torfree.net>
- Organization: Toronto Free-Net
- X-Newsreader: TIN [version 1.2 PL2]
- Date: Tue, 9 Apr 1996 22:52:49 GMT
-
- I am using unix compiler and I get the following error message
- II am learing on my own please help me. Last time when I posted I got
- lots of reply . Thanks .
- line 6: syntax error at or near type word "int"
- line 20: syntax error at or near type word "int"
- line 23: n undefined
- line 25: syntax error at or near word "if"
- line 26: x undefined
-
- #include <stdio.h>
- /*reoder 1 dim array, int array from smallest to largest*/
- main()
- {
- int i, n, x[100];
- reorder (int n , int x[]); /* LINE 6 */
- printf ("How many no:\n");
- scanf ("%d",&n);
- printf("\n");
- for (i=0; i<n;++i);
- {
- printf ("i = %d x = ",i+1);
- scanf ("%d", &x[n]);
- }
- reorder (n,x);
- printf ("Recorded list of nos:\n\n");
- for (i=0; i<n; ++i)
- printf ("i= %d x=%d\n", i+1, x[i]);
- }
- reorder (int n, int x[]) /* LINE 20 */
- {
- int item,i,temp;
- for (item=0; item < n-1; ++item) /* LINE 23 */
-
- for (i=item+1; i<n;++i/
- if (x[i]<x[item]) { /* LINE 25 */
- temp=x[item];
- x[item]=x[i];
- x[i]=temp;
- }
- return;
- }
-
- --
-